SEND AN EMAIL - PHP

Complete sample code to send an email:

<? php

$url = 'https://messagingapis.paylite.net/api/email/send';

$ch = curl_init($url);

$jsonData = '{

"ApiKey": "Your API Key",

"FromEmail": {

"Email": "From Email",

"Name": "From Name"

},

"ToEmail": [

{

"Email": "To Email Address",

"Name": "To Name"

}

],

"CcEmail": [

{

"Email": "Cc Email Address",

"Name": "Cc Name"

}

],

"BccEmail": [

{

"Email": "Bcc Email",

"Name": "Bcc Name"

}

],

"Subject": "Subject goes here",

"HtmlContent": "Html body goes here"

}';

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

$result = curl_exec($ch);

echo($result);

?>